// ================================================
// STORE AND RETRIEVE TWO HALFWORDS
//
// Memory layout:
//   0x1000–0x1001 = 0x1234
//   0x1002–0x1003 = 0x5678
//
// Expected results:
//   x4 = 0x00001234
//   x5 = 0x00005678
// ================================================

start:

// Load memory address 0x1000
lui  x1, 0x1              // x1 = 0x00001000

// Create the first value: 0x1234
lui  x2, 0x1              // x2 = 0x00001000
addi x2, x2, 0x234        // x2 = 0x00001234

// Create the second value: 0x5678
lui  x3, 0x5              // x3 = 0x00005000
addi x3, x3, 0x678        // x3 = 0x00005678

// Store two halfwords
sh   x2, 0(x1)            // Store 0x1234 at 0x1000
sh   x3, 2(x1)            // Store 0x5678 at 0x1002

// Retrieve the two halfwords
lh   x4, 0(x1)            // x4 = 0x00001234
lh   x5, 2(x1)            // x5 = 0x00005678

// Display the retrieved values
cout << "First halfword  = " << _to_hex x4 << endl;
cout << "Second halfword = " << _to_hex x5 << endl;
